﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;

namespace BLL
{
    public class QueryPayRecordsByTimeTransaction : QueryPayRecordsTransaction
    {
        private DateTime beginDate;
        private DateTime endDate;

        public QueryPayRecordsByTimeTransaction(DateTime _beginDate, DateTime _endDate)
        {
            this.beginDate = _beginDate.Date;
            this.endDate = _endDate.Date;
        }

        public QueryPayRecordsByTimeTransaction()
        {
            beginDate = DateTime.Now.Date;
            endDate = DateTime.Now.Date;
        }

        public IList<T_PayRecordsObject> FiltPayRecords
        {
            get
            {
                base.Execute();
                IList<T_PayRecordsObject> results = base.PayRecords;
                if (beginDate == endDate)
                {
                    results = results.Where(x => x.Db_PayDate.Date == beginDate).ToList();
                }
                else
                {
                    results = results.Where(x => x.Db_PayDate.Date >= beginDate && x.Db_PayDate.Date <= endDate).ToList();
                }
                return results;
            }
        }
    }
}
